<?php

class RequestedElementRecord extends TActiveRecord
{
	const TABLE = 'requested_elements';
	
	// fields
	public $id;
	public $name;
	public $status;
	public $description;
	public $session_id;
	public $owner_id;
	
	public function getId()            { return $this->id; }
	public function getName()          { return $this->name; }
	public function getStatus()        { return $this->status; }
	public function getDescription()   { return $this->description; }
	public function getSessionId()     { return $this->session_id; }
	public function getOwnerId()       { return $this->owner_id; }
	
	
	public function setId($id)                     { $this->id = $id; }
	public function setName($name)                 { $this->name = $name; }
	public function setStatus($status)             { $this->status = $status; }
	public function setDescription($description)   { $this->description = $description; }
	public function setSessionId($session_id)      { $this->session_id = $session_id; }
	public function setOwnerId($owner_id)          { $this->owner_id = $owner_id; }
	
	public function setData($id, $name, $status, $description, $session_id, $owner_id)
	{
		$this->id = $id;
		$this->name = $name;
		$this->status = $status;
		$this->description = $description;
		$this->session_id = $session_id;
		$this->owner_id = $owner_id;
	}
	
	public function setDataByRequestedElementRecord($record)
	{
		if($record instanceof RequestedElementRecord)
		{
			$this->setData(	$record->getId(), $record->getName(), $record->getStatus(),
							$record->getDescription(), $record->getSessionId(), $record->getOwnerId());
		}
	}
	
	public function equals($record)
	{
		if($record instanceof RequestedElementRecord)
		{
			return	$this->getId() == $record->getId()							&&
					$this->getName() == $record->getName()						&&
					$this->getStatus() == $record->getStatus()					&&
					$this->getDescription() == $record->getDescription()		&&
					$this->getSessionId() == $record->getSessionId()			&&
					$this->getOwnerId()== $record->getOwnerId();
					
		}
		return false;
	}
	
	public static function finder($className=__CLASS__)
	{
		return parent::finder($className);
	}
}

?>